3D Graphics Programming with QuickDraw 3D 1.5.4
Previous | QD3D Book | Overview | Chapter Contents | Next |
Uns32 refID
An external reference object is used to permit an object defined in another file to be referenced at one or more locations in a metafile.
Version 1.0 of this document described a design for external references that was not implemented in QD3D 1.0. In implementing external references in QD3D 1.5 we have decided on a somewhat different design. Its main advantage is that it allows the table of contents to contain the ExternalReference type, which means that tables of contents can be searched for all external references.
Suppose that in metafile F2 you want to reference an object ObjR that's contained in some other metafile F1. For this to be possible, F1 must have an entry to object ObjR in its table of contents. In metafile F2, a reference to ObjR is made by an external reference object. Its syntax is:
Container (
ExternalReference ( 2 )
CString ( "ExtRefTransform.TXT"
)
)
In this example, 2 is the reference ID, which is the number used by the TOC to find the object in F1. The string "ExtRefTransform.TXT" is the name of file F1 enclosed in quotation marks.
There are two conditions that must be met by the TOC of any metafile that contains ExternalReference objects:
These are needed so that the QD3D call Q3File_GetExternalReferences works properly. This call looks at the objectTypes in the TOC to determine whether ExternalReference objects are present.
C string that gives the pathname of the file that contains the object to be externally referenced, as described above.
3DMetafile ( 1 5 Normal tableofcontents4> )
lambertillumination6:
LambertIllumination ( )
translate7:
Container (
ExternalReference ( 1 )
cstring8:
CString (
"ExtRefTransformAA.TXT"
)
)
box9:
Container (
ExternalReference ( 2 )
cstring10:
CString (
"ExtRefTransformAA.TXT"
)
)
Reference ( 1 )
tableofcontents4:
TableOfContents (
tableofcontents5> # next TOC
3 # reference seed
-1 # typeSeed
1 # tocEntryType
16 # tocEntrySize
2 # nEntries
1 translate7>
ExternalReference
2 box9>
ExternalReference
)
3DMetafile ( 1 5 Database
tableofcontents0> )
translate2:
Translate ( -40 30 20 )
box3:
Box (
25 0 0 # orientation
0 10 0 # majorAxis
0 0 20 # minorAxis
-30 -5 -10 # origin
)
tableofcontents0:
TableOfContents (
tableofcontents1> # next TOC
3 # reference seed
-1 # typeSeed
1 # tocEntryType
16 # tocEntrySize
2 # nEntries
1 translate2>
Translate
2 box3>
Box
)
Previous | QD3D Book | Overview | Chapter Contents | Next |